package com.heima.user.controller.v1;

import com.heima.model.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDTO;
import com.heima.user.service.ApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
@Api(value = "app端用户认证列表",tags = "用户列表")
public class ApUserRealnameController {

    @Autowired
    ApUserRealnameService apUserRealnameService;

    @ApiOperation(value = "app用户列表查询")
    @PostMapping("/list")
    public ResponseResult listByPage(@RequestBody AuthDTO authDTO){
        return apUserRealnameService.list(authDTO);
    }

    @ApiOperation(value = "实名认证通过")
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDTO authDTO){
        return apUserRealnameService.updateStatusById(authDTO, AdminConstants.PASS_AUTH);
    }
    @ApiOperation(value = "实名认证失败")
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDTO authDTO){
        return apUserRealnameService.updateStatusById(authDTO, AdminConstants.FAIL_AUTH);
    }

}
